package com.publish.file.service.auth;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * 查询指定用户名称的权限信息
 *
 */
@Service
public class UserRoleManagerService implements UserDetailsService {
//	@Autowired
//	AuthService authServiceImpl;
	private Logger logger = LoggerFactory.getLogger(getClass().getSimpleName());

	@Override
	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//		String password = authServiceImpl.getPassword(username);
		String password = username;
		logger.info("加载用户:" + username + password);
		if (password == null) {
			throw new UsernameNotFoundException("User '" + username + "' not found");
		}
		return new UserRoleDetail(password, username);
	}

}
